
	{include template('header','common')}	
	<div id="Mainbox">
<script src="{THEME_STYLE_PATH}style/js/jquery.min.js"></script>
<link href="{THEME_STYLE_PATH}style/css/prize.css" type="text/css" rel="stylesheet" />
		<!--插入侧边栏-->
			{include template('sidebar_login','common')}
		<!--插入侧边栏-->
		<!--顶端公告-->
			{include template('top_advance','common')}

		<!--顶端公告-->
		<!--左侧-->
			{include template('mall_menu','common')}
		<!--左侧-->
		<!--右侧-->
			<div class="prize_right">
				<!--奖品详细页面-->
				<div class="prize_listbox">
					<div class="prize_content_in">
						<!--奖品图片-->
						<div class="prize_mode_i2"><div class="prize_mode_i2_in"><img src="{$rs['thumb']}" width="98" height="108"/></div></div>
						<!--奖品图片-->
						<!--奖品信息-->
						<div class="prize_info">
							<p class="title">{$rs['title']} <input type="hidden" id="title" value="{$rs['title']}" /></p>

							<?php 
								if($rs['credit_type'] == 'bean'){
									$imgs = "ud.gif";
									$converts = "豆";
									$u_num = $userinfo['u_bean'];
									$balance = $rs['credit_num'] - $u_num ;
								}else{
									$converts = '币';
									$imgs = 'ub.gif';
									$u_num = $userinfo['u_coin'];
									$balance = $rs['credit_num'] - $u_num ;

								} 
							 ?>
							<p class="a1">您兑换该奖品仅需：<span class="ofe"><strong id="giftValue">{$rs['credit_num']}
							<input type="hidden" id="credit_num" value="{$rs['credit_num']}" />
							</strong></span><img src="{THEME_STYLE_PATH}style/images/{$imgs}" style="margin-left:2px;"/></p>
							<p class="a1">
							{if $userinfo}								
								您当前拥有{type_change()}{$converts}：<span class="ofe">{$u_num}
							{else}
								您还未登录，请先<a href="/login/{__SELF__}" class="b4link">登录</a>。<br>还未注册？<a href="/register/" class="b40link">立即注册&gt;&gt;</a>
							{/if}
						<input type="hidden" id="nickname" value="{$userinfo['nickname']}" />
						<input type="hidden" id="shop_type" value="{$rs['shop_type']}" />
						<input type="hidden" id="credit_type" value="{$rs['credit_type']}" />
						</span>
						{if $userinfo}
						<img src="{THEME_STYLE_PATH}style/images/{$imgs}" style="margin-left:2px;"/>&nbsp;
						<span class="a1">

						<?php if($balance > 0) echo "（还需 ". $balance ?>
						<input type="hidden" name="balance" id="balance" value="{$balance}" />
						 （<a href="{U('Document/Index/lists',array('catid'=>2))}" class="b40link">继续赚{type_change()}币</a>）  </span>						 
						{/if}																		
						</p>
							<p class="btn"><a href="javascript:void(0);" class="dhbtn" id="jxy_gift_exchange"><strong>立即兑换</strong></a></p>
						</div>
						<!--奖品信息-->
						<div class="clear"></div>
					</div>
					<!--奖品介绍，兑奖须知-->
					<div class="prize_content_in">
						<ul class="pci_opt">
							<li class="on">奖品介绍</li>
							<li class="un">兑奖须知</li>
						</ul>
						<!--内容区域-->
						<div class="pci_info" id="jxy_prize_desc"><p>
	<img border="0" height="387" src="http://www.pceggs.com/IndexMainStatic/img/shangpinjieshao/SM1369_01.jpg" width="668" /></p>
<br />
<p>
	<img border="0" height="362" src="http://www.pceggs.com/IndexMainStatic/img/shangpinjieshao/SM1369_02.jpg" width="668" /></p>
<br />
<p>
	<img border="0" height="300" src="http://www.pceggs.com/IndexMainStatic/img/shangpinjieshao/SM1369_03.jpg" width="668" /></p>
</div>
						<div class="pci_dhinfo" id="jxy_prize_other" style="display:none;">
							<p class="a1"><strong>奖品寄送方式：</strong></p>
							<p class="a2">Q币、手机话费等直充类奖品兑奖审核通过后会直接充入您的QQ号码/手机号码中（QQ号码/手机号码为兑奖审核通过后自主填写），其余虚拟奖品采用在线发送卡密的方式；实体奖品全部采用快递方式。</p>
							<p class="a1"><strong>奖品兑换流程：</strong></p>
							<p style="margin-bottom:10px;">1. 奖品价格<span class="re1">已经包含邮寄费用在内</span>，您无须另行支付。兑奖前请确认您的帐户中有足够数量的{type_change()}币！<br>
								2. 在您要兑奖的奖品页面点击“立即兑换”按钮，提交您的兑奖申请！<br>
								3. 确认您的奖品邮寄地址、联系电话正确无误后提交兑奖申请 ！<br>
								4. 实物奖品将在您的兑奖确认后的2-5工作日内发出(奖品状态您可通过“<a href="{U('Member/Convert/prize')}" class="re1" style="text-decoration:underline;">我的奖品</a>”查询)！<br>
								5. 兑奖中心所有实物奖品颜色均为随机发送, 敬请谅解！<br>
								6. 奖品受供货商库存影响，会有缺货情况，如有缺货，客服会取消兑奖，退还兑奖{type_change()}币。</p>
							<p class="a3">兑奖过程中如有问题请通过“<a href="{U('Document/Index/lists',array('catid'=>30))}" class="re1" style="text-decoration:underline;">客服中心</a>”联系咨询。</p>
						</div>
						<!--内容区域-->
					</div>
				</div>
				<!--奖品详细页面-->
			</div>
		<!--右侧-->
		<input type="hidden" value="1370250402" id="pid">
		<input type="hidden" value="bb0e2fcb9821aab354973482195f6276" id="sign">
		<input type="hidden" value="#/prizeDetail.php?s=1&t=2&c=202&p=1370250402" id="re">
		<div class="clear"></div>
	</div>
	<!--主体-->
	<!--尾部-->
		{include template('footer','common')}	

	<!--尾部-->
</body>
</html>
<script type="text/javascript">
var _cardValue = "";var v = juxiangyou.component.verification;var code = "";
$(document).ready(function(){
	//juxiangyou.core.func.d_checklogin(true);
	
	
    $('.dhbtn').live('click',function(){
    	var nickname = $('#nickname').val();
		if(!nickname){
			alert("请先登录后进行兑换！");
			window.location.href = "/login/{__SELF__}";
			return false;
		}
		var _html = '<p style="text-align:left;">是否兑换<strong class="ofe">{$rs['title']}？</strong></p><p class="btn" style="text-align:left;"><a href="javascript:void(0);" class="public_w_btn_y" id="jxy_do_sure1">确认</a>&nbsp;&nbsp;<a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#jxy_pop_popSys1\'));" class="public_w_btn_y">取消</a></p>';
		popup.popSys1("兑换信息",_html,"500");
	
    
	$('#jxy_do_sure1').click(function(){
		doSure1();
		});
    });

	
	$('.pci_opt li').click(function(){
		if($(this).attr('class')=='on') return;
		var index = $(this).index();
		$('.pci_opt li').removeClass('on').addClass('un');
		$(this).removeClass('un').addClass('on');
		if(index==1){
			$('#jxy_prize_desc').hide();
			$('#jxy_prize_other').show();
		}else{
			$('#jxy_prize_desc').show();
			$('#jxy_prize_other').hide();
		}
	});

	$('.dh_tips_c a').mouseover(function(){
		$(this).attr('class','qrdh');
	}).mouseout(function(){
		$(this).attr('class','');
	});
		
	
});

function doSure1()
{
	// code = $.trim($("#tbCode").val());
	// if(v.chkInt(code,6,6)==false){
	// 	$("#errorTip").html("请输入正确的验证码！").fadeIn();setTimeout('$("#errorTip").fadeOut();', 1000);return;
	// }else{
	var balance = $('#balance').val();
	var name = $('#title').val();
	var credit_num = $('#credit_num').val();
	var nickname = $('#nickname').val();
	var shop_type = $('#shop_type').val();
	var credit_type = $('#credit_type').val();
	if(balance>0){
		alert('余额不足');
	}else{
		// $("#jxy_do_sure1").html("提交中...");
		// $("#jxy_do_sure1").attr("id","jxy_loading");

		var result = false;
		$.ajax({
			type: "POST",
			url: "<?php echo U('Member/Convert/index') ?>",
			dataType: "json",
			data : {"credit_num":credit_num,"name":name,'nickname':nickname,'shop_type':shop_type,'credit_type':credit_type},
			success: function(strJson){
				window.location.href = "<?php echo U('Member/Convert/prize') ?>"
			},
			error:function(strJson){
				alert("兑换失败");
			}
		});
	}
		
	// }
}
function doSure()
{
	juxiangyou.core.func.hidePopupDiv($('#jxy_pop_dosure'));
	var pid = $('#pid').val(); var sign = $('#sign').val(); var re = $('#re').val();
	juxiangyou.component.popup.loading();
	$.ajax({
		type:'POST',
		url:'/ajax.php',
		data:{"act":'exchangeGift',"code":code,"pid":pid,"sign":sign,"re":re},
		dataType:'json',
		error:function(){
			juxiangyou.core.func.hidePopupDiv($('#jxy_pop_loading'));
			alert('请求已经提交，请稍等~');
		},
		success:function(rst){
			juxiangyou.core.func.hidePopupDiv($('#jxy_pop_loading'));
			if(rst.error==10000){
				juxiangyou.component.popup._href = "/personal/Prize/";
				juxiangyou.component.popup.popSys2(rst.msg);
			}else if(rst.error==10105){
				juxiangyou.component.popup._href = "/personal/Details/";
				juxiangyou.component.popup.popSys2(rst.msg);
			}else{
				juxiangyou.component.popup.popSys2(rst.msg);
			}
		}
	}); 
}
function getCode()
{
	$.ajax({
		type: "POST",
		url: "/prizeDetail.php",
		dataType: "json",
		data : {"act":"getCode"},
		success: function(strJson){
			if(strJson.error==10000){
				ShowSecond(parseInt(60)); 
			}else{
				$("#errorTip").html(strJson.msg).fadeIn();setTimeout('$("#errorTip").fadeOut();', 1000);return;
			}
		}
	});
}
function ShowSecond(cDate)
{
	if(cDate > 1){
		var _html = '<span id="lastTime"><span style="color:red">'+(--cDate)+'</span>秒后可重新发送</span>';
		
		_html += '(或通过<span style="color:red">微信</span>获取，<a href="#/news/sys/2001" target="_blank" class="b40link" >如何获取>></a>)';
		$('#phoneArea').html(_html);
		setTimeout("ShowSecond("+cDate+")",1000);
	}
	else{
		var _html = '<a href="javascript:void(0);" onclick="getCode()" class="b40link">点击获取验证码</a>';
		$('#phoneArea').html(_html);
	} 

}
function closePopCash()
{
	 location.href = "#/personal/Phone/";
}
</script>

